<template>
  <div>
    <el-breadcrumb  separator-class="el-icon-arrow-right" class="breadcrumblocal">
      <el-breadcrumb-item v-for="(item,index) in breadcrumbList" v-bind:key="item.id">
        <i class="el-icon-ship" style="color: red; " v-show="index==0"></i>
        {{ item }}
      </el-breadcrumb-item>
    </el-breadcrumb>
  </div>
</template>

<script>
import request from '@/utils/request'

export default {
  name: 'BreadCrumb',
  data() {
    return {
      breadcrumbList: [],
      currentFunNo: null,
    }
  },
  props: {
 /*   ChildData: {
      type: String,
      default: '',
    },*/
    taskreportList:{
      type:Boolean,
      default:true,
    }
  },
  created() {
    //   任务上报做特殊处理 前端处理面包屑
   /* if(!this.taskreportList ) {
      let breadcrumbList = ['数字低代码 ']
      for(let val of this.$route.matched) {
        breadcrumbList.push(val.meta?.title)
      }
      return this.breadcrumbList = breadcrumbList
    }*/
    //if (this.ChildData) this.getinfo(this.ChildData)
  },
  watch: {
   //ChildData(val) {
   //  this.getinfo(val)
   //},
  },
  methods: {
    getinfo(funno) {
      if (funno == null || funno == undefined) {
        return
      }
      this.currentFunNo = funno
      this.getBreadcrumb(funno).then((response) => {
        let listdata = response.data
        if (listdata !== undefined && listdata.ctPathName != undefined) {
          this.breadcrumbList = listdata.ctPathName.split('/')
        }
      })
    },
    getBreadcrumb(ctFunNo) {
      return request({
        url: '/mis/breadcrumb/' + ctFunNo,
        method: 'get',
      })
    },
  },
}
</script>

<style scoped>
.breadcrumblocal {
  display: inline;
  height: 25px;
  line-height: 25px;
  margin: 2px 0;
}
</style>
